/*
 * Copyright 2010, 2011, 2012 mapsforge.org
 *
 * This program is free software: you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
namespace MapsUtilities
{

	/**
	 * A simple DTO to stores flags for debugging rendered map tiles.
	 */
	public class DebugSettings
	{
		private const long serialVersionUID = 1L;

		/**
		 * True if drawing of tile coordinates is enabled, false otherwise.
		 */
		public bool drawTileCoordinates;

		/**
		 * True if drawing of tile frames is enabled, false otherwise.
		 */
		public bool drawTileFrames;

		/**
		 * True if highlighting of water tiles is enabled, false otherwise.
		 */
		public bool highlightWaterTiles;

		private int hashCodeValue;

		/**
		 * @param drawTileCoordinates
		 *            if drawing of tile coordinates is enabled.
		 * @param drawTileFrames
		 *            if drawing of tile frames is enabled.
		 * @param highlightWaterTiles
		 *            if highlighting of water tiles is enabled.
		 */
		public DebugSettings ( bool drawTileCoordinates, bool drawTileFrames, bool highlightWaterTiles )
		{
			this.drawTileCoordinates = drawTileCoordinates;
			this.drawTileFrames = drawTileFrames;
			this.highlightWaterTiles = highlightWaterTiles;
			this.hashCodeValue = calculateHashCode();
		}

		//@Override
		public override bool Equals ( object obj )
		{
			if (this == obj) {
				return true;
			}
			if (!(obj is DebugSettings)) {
				return false;
			}
			DebugSettings other = (DebugSettings)obj;
			if (this.drawTileCoordinates != other.drawTileCoordinates) {
				return false;
			}
			if (this.drawTileFrames != other.drawTileFrames) {
				return false;
			}
			if (this.highlightWaterTiles != other.highlightWaterTiles) {
				return false;
			}
			return true;
		}

		//@Override
		public override int GetHashCode ()
		{
			return this.hashCodeValue;
		}

		/**
		 * @return the hash code of this object.
		 */
		private int calculateHashCode ()
		{
			int result = 1;
			result = 31 * result + (this.drawTileCoordinates ? 1231 : 1237);
			result = 31 * result + (this.drawTileFrames ? 1231 : 1237);
			result = 31 * result + (this.highlightWaterTiles ? 1231 : 1237);
			return result;
		}
	}
}